﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using EveMarketsDAO;

namespace EveMarkets.UserControls
{
	/// <summary>
	/// Logique d'interaction pour UcChoixSysteme.xaml
	/// </summary>
	public partial class UcChoixSysteme : UserControl
	{
		private IList _listRegion;
		public IList ListRegion
		{
			get { return _listRegion; }
			set
			{
				_listRegion = value;
				cBoxRegion.ItemsSource = value;
			}
		}

		private string _nomDuHeader;
		public string NomDuHeader
		{
			get { return _nomDuHeader; }
			set
			{
				_nomDuHeader = value;
				gBox.Content = value;
			}
		}

		/// <summary>
		/// Construit l'userControl
		/// </summary>
		public UcChoixSysteme()
		{
			InitializeComponent();
		}


		private void ChangementRegion(object sender, SelectionChangedEventArgs e)
		{
			cBoxStation.ItemsSource = null;
			cBoxSystem.ItemsSource = null;
			cBoxSystem.ItemsSource = ContexteDAO.ChoixSystemeParRapportRegion(cBoxRegion.SelectedItem.ToString());
			imgWrongRegion.Visibility = Visibility.Hidden;
		}

		private void ChangementSysteme(object sender, SelectionChangedEventArgs e)
		{
			cBoxStation.ItemsSource = null;
			if(cBoxSystem.SelectedIndex != -1)
				cBoxStation.ItemsSource = ContexteDAO.ChoixStationParRapportAuSysteme(cBoxSystem.SelectedItem.ToString());
		}

	}
}
